import { createApp } from 'vue'
import App from './App.vue'
import store from './store'
import { setupRouter } from './router'

import ElementPlus from 'element-plus'
import zhCn from 'element-plus/es/locale/lang/zh-cn'
import 'element-plus/dist/index.css'
import * as ElIcon from '@element-plus/icons-vue'

import useBtnAuth from './hooks/useBtnAuth'
import myMessageBox from './utils/myMessageBox'
import objCoppy from './utils/objCoppy'
import resetForm from './utils/resetForm'

const app = createApp(App)
app.use(store)
setupRouter(app)
Object.keys(ElIcon).forEach(key => {
    app.component(key, ElIcon[key as keyof typeof ElIcon])
})
app.use(ElementPlus, { locale: zhCn, })
app.mount("#app")
// 注册按钮权限
const { permission } = useBtnAuth()
app.directive('permission', permission)
// 挂载工具
app.config.globalProperties.$myMessageBox = myMessageBox
app.config.globalProperties.$objCoppy = objCoppy
app.config.globalProperties.$resetForm = resetForm